# -*- mode: python; -*-

Import("env")
Import("get_option")
Import("has_option")
Import("wiredtiger")

env = env.Clone()

env.Library(
    target='testframework',
    source=[
        'framework_options_init.cpp',
        'framework_options.cpp',
        'framework_options.idl',
        'framework.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/catalog/catalog_impl',
        '$BUILD_DIR/mongo/db/catalog/database_holder',
        '$BUILD_DIR/mongo/db/dbdirectclient',
        '$BUILD_DIR/mongo/db/index/index_access_method',
        '$BUILD_DIR/mongo/db/index_builds_coordinator_mongod',
        '$BUILD_DIR/mongo/db/op_observer/op_observer',
        '$BUILD_DIR/mongo/db/server_base',
        '$BUILD_DIR/mongo/db/service_context_d',
        '$BUILD_DIR/mongo/db/storage/flow_control_parameters',
        '$BUILD_DIR/mongo/db/storage/storage_control',
        '$BUILD_DIR/mongo/db/storage/storage_options',
        '$BUILD_DIR/mongo/scripting/scripting_common',
        '$BUILD_DIR/mongo/unittest/unittest',
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/s/sharding_runtime_d',
        '$BUILD_DIR/mongo/util/options_parser/options_parser_init',
    ],
)

env.Library(
    target='mocklib',
    source=[
        'mock/mock_conn_registry.cpp',
        'mock/mock_dbclient_connection.cpp',
        'mock/mock_remote_db_server.cpp',
        'mock/mock_replica_set.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/client/clientdriver_network',
        '$BUILD_DIR/mongo/client/dbclient_mockcursor',
        '$BUILD_DIR/mongo/client/replica_set_monitor_test_helper',
        '$BUILD_DIR/mongo/db/repl/replica_set_messages'
    ],
    LIBDEPS_PRIVATE=[
        '$BUILD_DIR/mongo/db/exec/projection_executor',
        '$BUILD_DIR/mongo/db/query/projection_ast',
        '$BUILD_DIR/mongo/db/query/query_test_service_context',
        '$BUILD_DIR/mongo/db/query_expressions',
    ],
)

dbtest = env.Program(
    target='dbtest',
    source=[
        'basictests.cpp',
        'catalogtests.cpp',
        'clienttests.cpp',
        'commandtests.cpp',
        'counttests.cpp',
        'cursor_manager_test.cpp',
        'dbhelper_tests.cpp',
        'dbtests.cpp',
        'deferred_writer.cpp',
        'directclienttests.cpp',
        'documentsourcetests.cpp',
        'extensions_callback_real_test.cpp',
        'index_access_method_test.cpp',
        'indexcatalogtests.cpp',
        'indexupdatetests.cpp',
        'insert_test.cpp',
        'jsobjtests.cpp',
        'jsontests.cpp',
        'jstests.cpp' if get_option('js-engine') != 'none' else [],
        'logical_sessions_tests.cpp',
        'matchertests.cpp' if get_option('js-engine') != 'none' else [],
        'mock_dbclient_conn_test.cpp',
        'mock_replica_set_test.cpp',
        'multikey_paths_test.cpp',
        'pdfiletests.cpp',
        'plan_executor_invalidation_test.cpp',
        'plan_ranking.cpp',
        'query_plan_executor.cpp',
        'query_stage_and.cpp',
        'query_stage_batched_delete.cpp',
        'query_stage_cached_plan.cpp',
        'query_stage_collscan.cpp',
        'query_stage_count.cpp',
        'query_stage_count_scan.cpp',
        'query_stage_delete.cpp',
        'query_stage_distinct.cpp',
        'query_stage_fetch.cpp',
        'query_stage_ixscan.cpp',
        'query_stage_limit_skip.cpp',
        'query_stage_merge_sort.cpp',
        'query_stage_multiplan.cpp',
        'query_stage_near.cpp',
        'query_stage_sort.cpp',
        'query_stage_sort_key_generator.cpp',
        'query_stage_subplan.cpp',
        'query_stage_tests.cpp',
        'query_stage_trial.cpp',
        'query_stage_update.cpp',
        'querytests.cpp',
        'replica_set_tests.cpp',
        'repltests.cpp',
        'rollbacktests.cpp',
        'socktests.cpp',
        'storage_debug_util.cpp',
        'threadedtests.cpp',
        'updatetests.cpp',
        'validate_tests.cpp',
        'wildcard_access_method_test.cpp',
        'wildcard_multikey_persistence_test.cpp',
    ],
    LIBDEPS=[
        "$BUILD_DIR/mongo/bson/mutable/mutable_bson_test_utils",
        "$BUILD_DIR/mongo/client/clientdriver_network",
        "$BUILD_DIR/mongo/client/replica_set_monitor_protocol_test_util",
        "$BUILD_DIR/mongo/db/auth/authmongod",
        "$BUILD_DIR/mongo/db/bson/dotted_path_support",
        "$BUILD_DIR/mongo/db/catalog/catalog_helpers",
        "$BUILD_DIR/mongo/db/catalog/clustered_collection_options",
        "$BUILD_DIR/mongo/db/catalog/collection_crud",
        "$BUILD_DIR/mongo/db/catalog/collection_validation",
        "$BUILD_DIR/mongo/db/catalog/index_key_validate",
        "$BUILD_DIR/mongo/db/catalog/multi_index_block",
        "$BUILD_DIR/mongo/db/commands/mongod",
        "$BUILD_DIR/mongo/db/commands/test_commands_enabled",
        "$BUILD_DIR/mongo/db/concurrency/deferred_writer",
        "$BUILD_DIR/mongo/db/exec/document_value/document_value_test_util",
        "$BUILD_DIR/mongo/db/index/index_access_method",
        "$BUILD_DIR/mongo/db/logical_time_metadata_hook",
        "$BUILD_DIR/mongo/db/mongohasher",
        "$BUILD_DIR/mongo/db/multitenancy",
        "$BUILD_DIR/mongo/db/op_observer/op_observer_impl",
        "$BUILD_DIR/mongo/db/op_observer/oplog_writer_impl",
        "$BUILD_DIR/mongo/db/ops/write_ops",
        "$BUILD_DIR/mongo/db/query/collation/collator_interface_mock",
        "$BUILD_DIR/mongo/db/query/command_request_response",
        "$BUILD_DIR/mongo/db/query/query_planner_test_lib",
        "$BUILD_DIR/mongo/db/query/query_request",
        "$BUILD_DIR/mongo/db/query/query_test_service_context",
        "$BUILD_DIR/mongo/db/query_exec",
        "$BUILD_DIR/mongo/db/repl/drop_pending_collection_reaper",
        "$BUILD_DIR/mongo/db/repl/oplog_entry_test_helpers",
        "$BUILD_DIR/mongo/db/repl/repl_coordinator_interface",
        "$BUILD_DIR/mongo/db/repl/replication_consistency_markers_impl",
        "$BUILD_DIR/mongo/db/repl/replication_recovery",
        "$BUILD_DIR/mongo/db/repl/replmocks",
        "$BUILD_DIR/mongo/db/repl/serveronly_repl",
        "$BUILD_DIR/mongo/db/repl/storage_interface_impl",
        "$BUILD_DIR/mongo/db/server_base",
        "$BUILD_DIR/mongo/db/session/sessions_collection_standalone",
        "$BUILD_DIR/mongo/db/shard_role",
        "$BUILD_DIR/mongo/db/storage/durable_catalog_impl",
        "$BUILD_DIR/mongo/db/storage/storage_engine_impl",
        "$BUILD_DIR/mongo/db/traffic_reader",
        "$BUILD_DIR/mongo/db/transaction/transaction",
        "$BUILD_DIR/mongo/db/vector_clock",
        "$BUILD_DIR/mongo/db/working_set_common",
        "$BUILD_DIR/mongo/shell/shell_utils",
        "$BUILD_DIR/mongo/transport/message_compressor_options_server",
        "$BUILD_DIR/mongo/transport/transport_layer_manager",
        "$BUILD_DIR/mongo/util/clock_source_mock",
        "$BUILD_DIR/mongo/util/net/network",
        "$BUILD_DIR/mongo/util/options_parser/options_parser_init",
        "$BUILD_DIR/mongo/util/password",
        "$BUILD_DIR/mongo/util/processinfo",
        "$BUILD_DIR/mongo/util/progress_meter",
        "$BUILD_DIR/mongo/util/signal_handlers",
        "$BUILD_DIR/mongo/util/version_impl",
        "mocklib",
        "testframework",
    ],
    AIB_COMPONENT="dbtest",
    AIB_COMPONENTS_EXTRA=[
        "tests",
    ],
    env.Default(dbtest)
)
